package movee.telnet.client;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class TelnetClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(TelnetClientApplication.class, args);
    }

    @Bean
    public CommandLineRunner runner() {
        return (args) -> {
            LocalTelnetClient telnetClient = new LocalTelnetClient("192.168.238.226", "umadmin", "umadmin", "huawei");
            telnetClient.connect();
            telnetClient.sendThenExpect("screen-length 0 temporary",
                    LocalTelnetClient.CMD_PROMPT, LocalTelnetClient.EXEC_TIMEOUT);
            telnetClient.sendThenExpect("display version", 
                    LocalTelnetClient.CMD_PROMPT, LocalTelnetClient.EXEC_TIMEOUT);
            telnetClient.close();
        };
    }

}
